﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SalesSys.DAL.Base;
using System.ComponentModel;

namespace SalesSys.DAL.Models
{
    /// <summary>
    /// 发货单来源类型
    /// </summary>
    public enum DeliverySheetSource
    {
        /// <summary>
        /// 销售
        /// </summary>
        [Description("销售")]
        Sale = 0,
        /// <summary>
        /// 库存
        /// </summary>
        [Description("库存")]
        Stock = 1
    }
    /// <summary>
    /// 发货单
    /// </summary>
    public class DeliverySheet : DbEntityBase<Guid>
    {
        /// <summary>
        /// 发货单来源
        /// </summary>
        public DeliverySheetSource From { get; set; }

        /// <summary>
        /// 来源编号
        /// </summary>
        public Guid? FromId { get; set; }

        /// <summary>
        /// 仓库id
        /// </summary>
        public Guid ProviderId { get; set; }

        /// <summary>
        /// 供应商名称
        /// </summary>
        public string ProviderName { get; set; }

        /// <summary>
        /// 商品列表
        /// </summary>
        public virtual ICollection<DeliverySheetGoods> GoodsList { get; set; }

        /// <summary>
        /// 收据
        /// </summary>
        public string Receipt { get; set; }
        public class Mapper : SalMapper<DeliverySheet, Guid>
        {
            public Mapper()
            {
                
            }
        }
    }
    /// <summary>
    /// 发货单商品
    /// </summary>
    public class DeliverySheetGoods : DbEntityBase<Guid>
    {
        /// <summary>
        /// 商品
        /// </summary>
        public virtual Commodity Commodity { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public int Count { get; set; }
        /// <summary>
        /// 实际重量
        /// </summary>
        [DecimalPrecision(18, 3)]
        public decimal Weight { get; set; }

        /// <summary>
        /// 原重量
        /// </summary>
        [DecimalPrecision(18, 3)]
        public decimal SourceWeight { get; set; }

        /// <summary>
        /// 原数量
        /// </summary>
        public decimal SourceCount { get; set; }
        public class Mapper : SalMapper<DeliverySheetGoods, Guid>
        {
            public Mapper()
            {

            }
        }
    }
}
